/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author YDZ
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface PoOrder extends BasicModel<PoOrder> {
  code?: string; // 采购单号
  venCode?: string; // 供应商编码
  ddate?: string; // 单据日期
  createByName?: string; // 制单人名称
  updateByName?: string; // 修改人名称
  djStatus?: string; // 单据状态
  poOrderCList?: any[]; // 子表列表
}

export const poOrderList = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/list', params });

export const poOrderListData = (params?: PoOrder | any) =>
  defHttp.post<Page<PoOrder>>({ url: adminPath + '/pu/order/poOrder/listData', params });

export const poOrderCListData = (params?: PoOrder | any) =>
  defHttp.post<Page<PoOrder>>({ url: adminPath + '/pu/order/poOrder/poOrderCListData', params });

export const orderSelectData = (params?: PoOrder | any) =>
  defHttp.post<Page<PoOrder>>({ url: adminPath + '/pu/order/poOrder/orderSelectData', params });

export const poOrderPoListData = (params?: PoOrder | any) =>
  defHttp.post<Page<PoOrder>>({ url: adminPath + '/pu/order/poOrder/poListData', params });

export const poOrderForm = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/form', params });

export const poOrderSave = (params?: any, data?: PoOrder | any) =>
  defHttp.postJson<PoOrder>({ url: adminPath + '/pu/order/poOrder/save', params, data });

export const poOrderDelete = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/delete', params });

// 整单关闭
export const poOrderCloseOrder = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/closeOrder', params });

// 整单开启
export const poOrderOpenOrder = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/openOrder', params });

// 行关闭
export const poOrderCloseRow = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/closeRow', params });

// 行打开
export const poOrderOpenRow = (params?: PoOrder | any) =>
  defHttp.get<PoOrder>({ url: adminPath + '/pu/order/poOrder/openRow', params });

export const poOrderScanPicAddRow = (params?: PoOrder | any) =>
  defHttp.post<PoOrder>({ url: adminPath + '/pu/order/poOrder/scanPicAddRow', params });
